// run: $exec < input
#include <cstdio>

int n, l, a, b;

void work(int len, int & now, int & ans)
{
	if (len * a > now) {
		ans += (len * a - now);
		now = 0;
	} else {
		now -= len * a;
	}
}

int main()
{
	int T;
	std::scanf("%d", &T);
	for (int ti = 1; ti <= T; ti++) {
		std::printf("Case #%d: ", ti);
		std::scanf("%d %d %d %d", &n, &a, &b, &l);
		int ans = 0, tl, tr, now = 0;
		std::scanf("%d %d", &tl, &tr);
		now = (tl - 0) * b;
		work(tr - tl, now, ans);
		for (int i = 1; i < n; i++) {
			int ttl, ttr;
			std::scanf("%d %d", &ttl, &ttr);
			now += (ttl - tr) * b;
			work(ttr - ttl, now, ans);
			tl = ttl;  tr = ttr;
		}
		std::printf("%d\n", ans);
	}
}
